

#include <boost/asio.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
//---------------------------------------------

   class WebSocketSession;

   class WebSocketServer: private boost::noncopyable
   {
   private:
      typedef boost::shared_ptr<WebSocketSession> WebSocketSessionPtr;

   public:
      WebSocketServer(unsigned int port, unsigned int workers);
      ~WebSocketServer();

   public:
      void start();

   private:
      void asyncAccept();
      void internalRun();
      void handleAccept(WebSocketSessionPtr webSockSession, const boost::system::error_code& error);

   private:
      boost::asio::io_service mIoService;
      boost::asio::ip::tcp::acceptor mAcceptor;
      unsigned int mWorkers;
      WebSocketSessionPtr mWebSocketSession;
      unsigned int mPort;
   };

